﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;

using CSF.Security.Service;
using CSF.Security.Data;

namespace CSF.Service.Accounts.Client
{
    /// <summary>
    /// 用户账户业务服务客户端类
    /// </summary>
    public class UserAccountSvcClient : ClientBase<IUserAccountSvc>, IUserAccountSvc
    {
        #region IDataIdKeyService<UserAccount> 成员

        public UserAccount GetOneById(int id)
        {
            return base.Channel.GetOneById(id);
        }

        public bool UpdateById(UserAccount t, int id)
        {
            return base.Channel.UpdateById(t, id);
        }

        public bool DeleteOneById(int id)
        {
            return base.Channel.DeleteOneById(id);
        }

        #endregion

        #region IDataEntityService<UserAccount> 成员

        public List<UserAccount> GetAll()
        {
            return base.Channel.GetAll();
        }

        public int Insert(UserAccount entity)
        {
            return base.Channel.Insert(entity);
        }

     

        #endregion

        #region IUserAccountSvc 成员

        public IEnumerable<int> GetUserRoles(int userId)
        {
            return base.Channel.GetUserRoles(userId);
        }

        public void SetUserRole(int userId, IEnumerable<int> roleIds, string createBy)
        {
            base.Channel.SetUserRole(userId, roleIds, createBy);
        }

        #endregion

        #region IDataIdKeyService<UserAccount> 成员


        public int DeleteById(IEnumerable<int> ids)
        {
            return base.Channel.DeleteById(ids);
        }

        #endregion

        #region IUserAccountSvc 成员


        public bool UpdateBySelf(UserAccount account)
        {
            return base.Channel.UpdateBySelf(account);
        }

        /// <summary>
        /// 修改用户密码
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="oldPassword">旧密码</param>
        /// <param name="newPassword">新密码</param>
        /// <returns></returns>
        public bool ChangePassword(int userId, string oldPassword, string newPassword, string changeBy)
        {
            return base.Channel.ChangePassword(userId, oldPassword, newPassword, changeBy);
        }

        #endregion
    }
}
